<template>
  <el-aside width="250px">
    <el-menu
      default-active="1-1"
      class="el-menu-vertical-demo"
      @open="handleOpen"
      @close="handleClose">
      <el-submenu index="1">
        <template slot="title">
          <i class="el-icon-location"></i>
          <span>国内疫情防控</span>
        </template>
        <el-menu-item-group>
          <router-link to="/">
            <el-menu-item index="1-1">国内疫情分布</el-menu-item>
          </router-link>
          <router-link to="/stats">
            <el-menu-item index="1-2">国内疫情情况统计</el-menu-item>
          </router-link>
        </el-menu-item-group>
      </el-submenu>
      <el-menu-item index="2" @click="change('/global')">
        <i class="el-icon-location"></i>
        <span>全球疫情分布</span>
      </el-menu-item>
    </el-menu>
  </el-aside>
</template>

<script>
export default {
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
    change(url) {
      this.$router.push(url)
    }
  }
}
</script>

<style lang="scss" scoped>
  .el-aside {
    .el-menu {
      height: 100%;
    }
  }
</style>